<template>
  <el-tree :data="list" :props="{label:'name'}" />
</template>

<script>
// 请求
import { getPermissionList } from '@/api/permisson'
// 转换树形数据
import { tranListToTreeList } from '@/utils'
export default {
  data() {
    return {
      list: []
    }
  },
  created() {
    this.loadPermissionList()
  },
  methods: {
    async loadPermissionList() {
      try {
        const res = await getPermissionList()
        console.log('getPermissionList', res)
        // 保存数据
        this.list = tranListToTreeList(res.data.data)
      } catch (err) {
        console.log('getPermissionList', err)
      }
    }
  }
}
</script>

<style>

</style>
